<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/Model.php');
require_once($Config->WebCMSRoot.'Data/Ticket.php');

Class TicketModel extends BaseModel
{
	var $Code;
	var $FormID;
	var $Price;
	var $Created;
	var $Confirmed;
	var $Prepared;
	var $Cancelled;
	var $Email;
	var $Name;
	var $Address;
	var $City;
	
	function TicketModel()
	{
		$this->Code      = '';
		$this->FormID    = 0;
		$this->Price     = 0;
		$this->Created   = '';
		$this->Confirmed = '';
		$this->Prepared  = '';
		$this->Cancelled = '';
		$this->Email     = '';
		$this->Name      = '';
		$this->Address   = '';
		$this->City      = '';
		
		parent::BaseModel();
	}
	
	function Retrieve(&$parameters)
	{
		$db = new TicketData();
		$this->Parameters = &$parameters;
		
		$this->ID = $this->GetParameter('id');
		$this->Code = $this->GetParameter('code');
		$this->FormID = $this->GetParameter('FormID');
		$this->Created = $this->GetParameter('created');
		$this->Confirmed = $this->GetParameter('confirmed');
		$this->Prepared = $this->GetParameter('prepared');
		$this->Cancelled = $this->GetParameter('cancelled');
		
		$db->Retrieve(&$this);
	}
	
	function GetFormData()
	{
		$db = new TicketData();
		
		$db->GetTicketData(&$this);
//print('<pre>'.var_export($this, true).'</pre>');exit;
	}

	function Persist()
	{
		$db = new TicketData();

		$db->Update(&$this);
	}
	
}
?>